TOPSRCDIR = ..
TOPOBJDIR = ..
SRCDIR    = .

MODULE	  = none

IDL_H_SRCS = \
	activaut.idl \
	activdbg.idl \
	activscp.idl \
	amstream.idl \
	amvideo.idl \
	austream.idl \
	bits.idl \
	bits1_5.idl \
	comcat.idl \
	control.idl \
	d3d10.idl \
	ddstream.idl \
	dimm.idl \
	dispex.idl \
	docobj.idl \
	downloadmgr.idl \
	dxgi.idl \
	dxgitype.idl \
	exdisp.idl \
	fusion.idl \
	hlink.idl \
	htiframe.idl \
	iads.idl \
	icftypes.idl \
	imnact.idl \
	imnxport.idl \
	indexsrv.idl \
	mediaobj.idl \
	mimeinfo.idl \
	mimeole.idl \
	mlang.idl \
	mmstream.idl \
	mscoree.idl \
	mshtmhst.idl \
	mshtml.idl \
	msinkaut.idl \
	mstask.idl \
	msxml.idl \
	msxml2.idl \
	netfw.idl \
	oaidl.idl \
	objidl.idl \
	objsafe.idl \
	ocidl.idl \
	ocmm.idl \
	oleacc.idl \
	oledb.idl \
	oleidl.idl \
	optary.idl \
	propidl.idl \
	pstore.idl \
	qedit.idl \
	richole.idl \
	sensevts.idl \
	servprov.idl \
	shldisp.idl \
	shobjidl.idl \
	shtypes.idl \
	strmif.idl \
	tom.idl \
	unknwn.idl \
	urlhist.idl \
	urlmon.idl \
	vmr9.idl \
	wine/itss.idl \
	wine/svcctl.idl \
	wtypes.idl \
	xmldom.idl \
	xmldso.idl

IDL_TLB_SRCS = \
	stdole2.idl

SRCDIR_INCLUDES = \
	$(IDL_TLB_SRCS) \
	$(IDL_H_SRCS) \
	accctrl.h \
	aclapi.h \
	adshlp.h \
	advpub.h \
	appmgmt.h \
	audevcod.h \
	aviriff.h \
	axcore.idl \
	axextend.idl \
	basetsd.h \
	basetyps.h \
	bcrypt.h \
	bitsmsg.h \
	cderr.h \
	cfgmgr32.h \
	cguid.h \
	cierror.h \
	clusapi.h \
	commctrl.h \
	commdlg.h \
	compobj.h \
	cor.h \
	corerror.h \
	corhdr.h \
	cpl.h \
	cryptdlg.h \
	cryptuiapi.h \
	custcntl.h \
	cvconst.h \
	d3d.h \
	d3d8.h \
	d3d8caps.h \
	d3d8types.h \
	d3d9.h \
	d3d9caps.h \
	d3d9types.h \
	d3dcaps.h \
	d3dhal.h \
	d3drm.h \
	d3drmdef.h \
	d3drmobj.h \
	d3dtypes.h \
	d3dvec.inl \
	d3dx8.h \
	d3dx8core.h \
	d3dx8math.h \
	d3dx8math.inl \
	d3dx8mesh.h \
	d3dx9.h \
	d3dx9core.h \
	d3dx9math.h \
	d3dx9math.inl \
	d3dx9shader.h \
	d3dx9tex.h \
	dbghelp.h \
	dbinit.idl \
	dbprop.idl \
	dbs.idl \
	dbt.h \
	dciddi.h \
	dciman.h \
	dde.h \
	ddeml.h \
	ddk/compstui.h \
	ddk/hidsdi.h \
	ddk/imm.h \
	ddk/mountmgr.h \
	ddk/ntddcdvd.h \
	ddk/ntddk.h \
	ddk/ntddser.h \
	ddk/ntddtape.h \
	ddk/usb.h \
	ddk/usb100.h \
	ddk/usb200.h \
	ddk/usbdlib.h \
	ddk/wdm.h \
	ddk/winddiui.h \
	ddk/winsplp.h \
	ddraw.h \
	ddrawi.h \
	devenum.idl \
	devguid.h \
	digitalv.h \
	dinput.h \
	dispdib.h \
	dlgs.h \
	dls1.h \
	dls2.h \
	dmdls.h \
	dmerror.h \
	dmo.h \
	dmoreg.h \
	dmort.h \
	dmplugin.h \
	dmusbuff.h \
	dmusicc.h \
	dmusicf.h \
	dmusici.h \
	dmusics.h \
	dpaddr.h \
	dplay.h \
	dplay8.h \
	dplobby.h \
	dplobby8.h \
	dpnathlp.h \
	dsconf.h \
	dsdriver.h \
	dsgetdc.h \
	dshow.h \
	dsound.h \
	dsrole.h \
	dvdmedia.h \
	dwmapi.h \
	dxdiag.h \
	dxerr8.h \
	dxerr9.h \
	dxfile.h \
	dyngraph.idl \
	errorrep.h \
	errors.h \
	evcode.h \
	evntrace.h \
	excpt.h \
	exdispid.h \
	fci.h \
	fdi.h \
	gdiplus.h \
	gdipluscolor.h \
	gdipluscolormatrix.h \
	gdiplusenums.h \
	gdiplusflat.h \
	gdiplusgpstubs.h \
	gdiplusimaging.h \
	gdiplusinit.h \
	gdiplusmem.h \
	gdiplusmetaheader.h \
	gdipluspixelformats.h \
	gdiplustypes.h \
	guiddef.h \
	hlguids.h \
	htmlhelp.h \
	i_cryptasn1tls.h \
	icm.h \
	icmpapi.h \
	idispids.h \
	imagehlp.h \
	imm.h \
	initguid.h \
	intshcut.h \
	ipexport.h \
	iphlpapi.h \
	ipifcons.h \
	iprtrmib.h \
	iptypes.h \
	isguids.h \
	ks.h \
	ksguid.h \
	ksmedia.h \
	lm.h \
	lmaccess.h \
	lmapibuf.h \
	lmbrowsr.h \
	lmcons.h \
	lmerr.h \
	lmjoin.h \
	lmmsg.h \
	lmserver.h \
	lmshare.h \
	lmstats.h \
	lmuse.h \
	lmuseflg.h \
	lmwksta.h \
	lzexpand.h \
	mapi.h \
	mapicode.h \
	mapidefs.h \
	mapiform.h \
	mapiguid.h \
	mapitags.h \
	mapiutil.h \
	mapival.h \
	mapix.h \
	mciavi.h \
	mcx.h \
	mediaerr.h \
	midles.h \
	minmax.h \
	mmddk.h \
	mmreg.h \
	mmsystem.h \
	mprapi.h \
	msacm.h \
	msacmdlg.h \
	msacmdrv.h \
	mscat.h \
	mshtmcid.h \
	mshtmdid.h \
	msi.h \
	msidefs.h \
	msiquery.h \
	mssip.h \
	msvcrt/conio.h \
	msvcrt/crtdbg.h \
	msvcrt/ctype.h \
	msvcrt/direct.h \
	msvcrt/dirent.h \
	msvcrt/dos.h \
	msvcrt/eh.h \
	msvcrt/errno.h \
	msvcrt/fcntl.h \
	msvcrt/float.h \
	msvcrt/io.h \
	msvcrt/limits.h \
	msvcrt/locale.h \
	msvcrt/malloc.h \
	msvcrt/math.h \
	msvcrt/mbctype.h \
	msvcrt/mbstring.h \
	msvcrt/process.h \
	msvcrt/search.h \
	msvcrt/setjmp.h \
	msvcrt/share.h \
	msvcrt/signal.h \
	msvcrt/stddef.h \
	msvcrt/stdio.h \
	msvcrt/stdlib.h \
	msvcrt/string.h \
	msvcrt/sys/locking.h \
	msvcrt/sys/stat.h \
	msvcrt/sys/timeb.h \
	msvcrt/sys/types.h \
	msvcrt/sys/unistd.h \
	msvcrt/sys/utime.h \
	msvcrt/time.h \
	msvcrt/unistd.h \
	msvcrt/wchar.h \
	msvcrt/wctype.h \
	mswsock.h \
	msxml2did.h \
	msxmldid.h \
	nb30.h \
	ndrtypes.h \
	npapi.h \
	nspapi.h \
	ntddcdrm.h \
	ntddscsi.h \
	ntddstor.h \
	ntdsapi.h \
	ntquery.h \
	ntsecapi.h \
	ntsecpkg.h \
	ntstatus.h \
	objbase.h \
	objsel.h \
	odbcinst.h \
	ole2.h \
	ole2ver.h \
	oleauto.h \
	olectl.h \
	oledlg.h \
	pdh.h \
	pdhmsg.h \
	pktdef.h \
	poppack.h \
	powrprof.h \
	profinfo.h \
	propvarutil.h \
	prsht.h \
	psapi.h \
	pshpack1.h \
	pshpack2.h \
	pshpack4.h \
	pshpack8.h \
	ras.h \
	raserror.h \
	reason.h \
	regstr.h \
	richedit.h \
	rmxfguid.h \
	rpc.h \
	rpcasync.h \
	rpcdce.h \
	rpcdcep.h \
	rpcndr.h \
	rpcnterr.h \
	rpcproxy.h \
	scarderr.h \
	schannel.h \
	schemadef.h \
	schnlsp.h \
	sddl.h \
	secext.h \
	security.h \
	sensapi.h \
	setupapi.h \
	sfc.h \
	shdispid.h \
	shellapi.h \
	shlguid.h \
	shlobj.h \
	shlwapi.h \
	sipbase.h \
	slerror.h \
	slpublic.h \
	snmp.h \
	softpub.h \
	sql.h \
	sqlext.h \
	sqltypes.h \
	srrestoreptapi.h \
	sspi.h \
	storage.h \
	svrapi.h \
	tapi.h \
	tchar.h \
	textserv.h \
	tlhelp32.h \
	tmschema.h \
	twain.h \
	userenv.h \
	usp10.h \
	uuids.h \
	uxtheme.h \
	vdmdbg.h \
	ver.h \
	vfw.h \
	vfwmsgs.h \
	vmrender.idl \
	wfext.h \
	winbase.h \
	wincon.h \
	wincred.h \
	wincrypt.h \
	windef.h \
	windns.h \
	windows.h \
	windowsx.h \
	wine/debug.h \
	wine/exception.h \
	wine/library.h \
	wine/unicode.h \
	winerror.h \
	wingdi.h \
	winhttp.h \
	wininet.h \
	winineti.h \
	winioctl.h \
	winldap.h \
	winnetwk.h \
	winnls.h \
	winnls32.h \
	winnt.h \
	winperf.h \
	winreg.h \
	winresrc.h \
	winscard.h \
	winsmcrd.h \
	winsock.h \
	winsock2.h \
	winspool.h \
	winsvc.h \
	wintab.h \
	wintabx.h \
	winternl.h \
	wintrust.h \
	winuser.h \
	winver.h \
	wmistr.h \
	wnaspi32.h \
	wownt32.h \
	ws2spi.h \
	ws2tcpip.h \
	wshisotp.h \
	wsipx.h \
	wsnwlink.h \
	wtsapi32.h \
	xcmc.h \
	xmldomdid.h \
	xmldsodid.h \
	zmouse.h

EXTRASUBDIRS = ddk msvcrt msvcrt/sys wine

INSTALLDIRS = \
	$(DESTDIR)$(includedir)/windows/ddk \
	$(DESTDIR)$(includedir)/windows \
	$(DESTDIR)$(includedir)/msvcrt/sys \
	$(DESTDIR)$(includedir)/msvcrt \
	$(DESTDIR)$(includedir)

# Global rules shared by all makefiles     -*-Makefile-*-
#
# Each individual makefile must define the following variables:
# TOPSRCDIR    : top-level source directory
# TOPOBJDIR    : top-level object directory
# SRCDIR       : source directory for this module
# MODULE       : name of the module being built
#
# Each individual makefile may define the following additional variables:
# C_SRCS       : C sources for the module
# C_SRCS16     : 16-bit C sources for the module
# RC_SRCS      : resource source files
# EXTRA_SRCS   : extra source files for make depend
# EXTRA_OBJS   : extra object files
# IMPORTS      : dlls to import
# DELAYIMPORTS : dlls to import in delayed mode
# SUBDIRS      : subdirectories that contain a Makefile
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
# INSTALLSUBDIRS : subdirectories to run make install/uninstall into
# MODCFLAGS    : extra CFLAGS for this module

# First some useful definitions

SHELL     = /bin/sh
CC        = gcc
CFLAGS    = -g -O2
CPPFLAGS  = 
LIBS      = 
BISON     = bison
FLEX      = flex
EXEEXT    = 
OBJEXT    = o
LIBEXT    = so
DLLEXT    = .so
IMPLIBEXT = def
LDSHARED  = $(CC) -shared $(SONAME:%=-Wl,-soname,%) $(VERSCRIPT:%=-Wl,--version-script=%)
DLLTOOL   = false
DLLWRAP   = 
AR        = ar
ARFLAGS   = rc
RANLIB    = ranlib
STRIP     = strip
WINDRES   = false
LN        = ln
LN_S      = ln -s
TOOLSDIR  = $(TOPOBJDIR)
AS        = as
LD        = ld
NM        = nm
LDFLAGS   = 
PRELINK   = false
RM        = rm -f
MV        = mv
LINT      = 
LINTFLAGS = 
FONTFORGE = false
RSVG      = false
ICOTOOL   = false
INCLUDES     = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
EXTRACFLAGS  = -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wtype-limits -Wpointer-arith
ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
IDLFLAGS     = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
WINEBUILDFLAGS = $(DLLFLAGS) --as-cmd "$(AS)"
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
WINEWRAPPER  = $(TOPSRCDIR)/tools/winewrapper
C2MAN        = $(TOPSRCDIR)/tools/c2man.pl
RUNTEST      = $(TOPSRCDIR)/tools/runtest
WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild
MAKEDEP      = $(TOOLSDIR)/tools/makedep
MAKECTESTS   = $(TOOLSDIR)/tools/make_ctests
WRC          = $(TOOLSDIR)/tools/wrc/wrc
WMC          = $(TOOLSDIR)/tools/wmc/wmc
WIDL         = $(TOOLSDIR)/tools/widl/widl
WINEGCC      = $(TOOLSDIR)/tools/winegcc/winegcc
RELPATH      = $(TOOLSDIR)/tools/relpath
SFNT2FNT     = $(TOOLSDIR)/tools/sfnt2fnt
FNT2FON      = $(TOOLSDIR)/tools/fnt2fon
RC           = $(WRC)
RC16         = $(WRC)
RCFLAGS      = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
RC16FLAGS    = -O res16 $(RCFLAGS)
LDPATH       = 
DLLDIR       = $(TOPOBJDIR)/dlls
LIBPORT      = $(TOPOBJDIR)/libs/port/libwine_port.a
LIBWPP       = $(TOPOBJDIR)/libs/wpp/libwpp.a
LIBWINE      = -L$(TOPOBJDIR)/libs/wine -lwine
LDRPATH_INSTALL = -Wl,--rpath,\$$ORIGIN/`$(RELPATH) $(bindir) $(libdir)` -Wl,--enable-new-dtags
LDRPATH_LOCAL   = -Wl,--rpath,\$$ORIGIN/$(TOPOBJDIR)/libs/wine



# Installation infos

INSTALL         = /usr/bin/install -c $(INSTALL_FLAGS)
INSTALL_PROGRAM = ${INSTALL} $(INSTALL_PROGRAM_FLAGS)
INSTALL_SCRIPT  = ${INSTALL} $(INSTALL_SCRIPT_FLAGS)
INSTALL_DATA    = ${INSTALL} -m 644 $(INSTALL_DATA_FLAGS)
prefix          = /usr/local
exec_prefix     = ${prefix}
bindir          = ${exec_prefix}/bin
libdir          = ${exec_prefix}/lib
datarootdir     = ${prefix}/share
datadir         = ${datarootdir}
infodir         = ${datarootdir}/info
mandir          = ${datarootdir}/man
sysconfdir      = ${prefix}/etc
includedir      = ${prefix}/include/wine
dlldir          = ${exec_prefix}/lib/wine
prog_manext     = 1
api_manext      = 3w
conf_manext     = 5
CLEAN_FILES     = *.o *.a *.so *.ln *.res *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core

IDL_GEN_C_SRCS  = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
                  $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
                  $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)

CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
                $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)

OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)

RCOBJS = $(RC_SRCS:.rc=.res.o)
LINTS  = $(C_SRCS:.c=.ln)

# 'all' target first in case the enclosing Makefile didn't define any target

all:

filter: dummy
	@$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all

.PHONY: all filter

# Implicit rules

.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c # .sfd .ttf .svg .ico

.c.o:
	$(CC) -c $(ALLCFLAGS) -o $@ $<

.s.o:
	$(AS) -o $@ $<

.y.tab.c:
	$(BISON) $(BISONFLAGS) -p $*_ -o $@ $<

.y.tab.h:
	$(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<

.l.yy.c:
	$(FLEX) $(LEXFLAGS) -o$@ $<

.mc.mc.rc:
	$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<

.rc.res:
	$(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<

.res.res.o:
	$(WINDRES) -i $< -o $@

.spec.spec.o:
	$(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<

.idl.h:
	$(WIDL) $(IDLFLAGS) -h -H $@ $<

.idl_c.c:
	$(WIDL) $(IDLFLAGS) -c -C $@ $<

.idl_i.c:
	$(WIDL) $(IDLFLAGS) -u -U $@ $<

.idl_p.c:
	$(WIDL) $(IDLFLAGS) -p -P $@ $<

.idl_s.c:
	$(WIDL) $(IDLFLAGS) -s -S $@ $<

.idl.tlb:
	$(WIDL) $(IDLFLAGS) -t -T $@ $<

.c.ln:
	$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )

.c.ok:
	$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@

.sfd.ttf:
	$(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@

.man.in.man:
	LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,Wine 1.1.6,g' $< >$@ || ($(RM) $@ && false)

.svg.ico:
	$(RSVG) -w 16 -h 16 -f png $< $*-16.png
	$(RSVG) -w 32 -h 32 -f png $< $*-32.png
	$(RSVG) -w 48 -h 48 -f png $< $*-48.png
	$(ICOTOOL) -c -o $@ $*-16.png $*-32.png $*-48.png
	$(RM) $*-16.png $*-32.png $*-48.png

# Rules for IDL files

dlldata.c: $(WIDL) Makefile.in
	$(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)

# Rule for linting

$(MODULE).ln : $(LINTS)
	if test "$(LINTS)" ; \
	then \
		$(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
	        $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
	else \
		$(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
	fi

lint:: $(MODULE).ln

# Rules for Windows API checking

winapi_check:: dummy
	$(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .

.PHONY: winapi_check

# Rules for dependencies

DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \
              $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
              $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
              $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)

$(SUBDIRS:%=%/__depend__): dummy
	@cd `dirname $@` && $(MAKE) depend

depend: $(SUBDIRS:%=%/__depend__) dummy
	$(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)

.PHONY: depend $(SUBDIRS:%=%/__depend__)

# Rules for cleaning

$(SUBDIRS:%=%/__clean__): dummy
	@cd `dirname $@` && $(MAKE) clean

$(EXTRASUBDIRS:%=%/__clean__): dummy
	-cd `dirname $@` && $(RM) $(CLEAN_FILES)

clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
	$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)

.PHONY: clean $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)

# Rules for installing

$(SUBDIRS:%=%/__install__): dummy
	@cd `dirname $@` && $(MAKE) install

$(SUBDIRS:%=%/__install-lib__): dummy
	@cd `dirname $@` && $(MAKE) install-lib

$(SUBDIRS:%=%/__install-dev__): dummy
	@cd `dirname $@` && $(MAKE) install-dev

$(SUBDIRS:%=%/__uninstall__): dummy
	@cd `dirname $@` && $(MAKE) uninstall

install:: $(INSTALLSUBDIRS:%=%/__install__)
install-lib:: $(INSTALLSUBDIRS:%=%/__install-lib__)
install-dev:: $(INSTALLSUBDIRS:%=%/__install-dev__)
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)

$(INSTALLDIRS):
	$(MKINSTALLDIRS) $@

.PHONY: install install-lib install-dev uninstall \
	$(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
	$(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)

# Rules for testing

$(TESTSUBDIRS:%=%/__test__): dummy
	@cd `dirname $@` && $(MAKE) test

$(TESTSUBDIRS:%=%/__crosstest__): dummy
	@cd `dirname $@` && $(MAKE) crosstest

$(TESTSUBDIRS:%=%/__testclean__): dummy
	@cd `dirname $@` && $(MAKE) testclean

check test:: $(TESTSUBDIRS:%=%/__test__)

crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)

testclean:: $(TESTSUBDIRS:%=%/__testclean__)

.PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__) 

# Rules for auto documentation

$(DOCSUBDIRS:%=%/__man__): dummy
	@cd `dirname $@` && $(MAKE) man

$(DOCSUBDIRS:%=%/__doc_html__): dummy
	@cd `dirname $@` && $(MAKE) doc-html

$(DOCSUBDIRS:%=%/__doc_sgml__): dummy
	@cd `dirname $@` && $(MAKE) doc-sgml

man: $(DOCSUBDIRS:%=%/__man__)
doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)

.PHONY: man doc-html doc-sgml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__)

# Misc. rules

$(MC_SRCS:.mc=.mc.rc): $(WMC)

$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)

$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)

$(SUBDIRS): dummy
	@cd $@ && $(MAKE)

dummy:

.PHONY: dummy $(SUBDIRS)

# End of global rules

OBJDIR_INCLUDES = $(IDL_H_SRCS:.idl=.h) $(IDL_TLB_SRCS:.idl=.tlb)

all: $(OBJDIR_INCLUDES)

install install-dev:: $(OBJDIR_INCLUDES) $(INSTALLDIRS)
	for f in $(SRCDIR_INCLUDES); do case $$f in \
	  wine/*)   $(INSTALL_DATA) $(SRCDIR)/$$f $(DESTDIR)$(includedir)/`expr $$f : 'wine/\(.*\)'` ;; \
	  msvcrt/*) $(INSTALL_DATA) $(SRCDIR)/$$f $(DESTDIR)$(includedir)/$$f ;; \
	  *)        $(INSTALL_DATA) $(SRCDIR)/$$f $(DESTDIR)$(includedir)/windows/$$f ;; \
	esac; done
	for f in $(OBJDIR_INCLUDES); do case $$f in \
	  wine/*)   $(INSTALL_DATA) $$f $(DESTDIR)$(includedir)/`expr $$f : 'wine/\(.*\)'` ;; \
	  msvcrt/*) $(INSTALL_DATA) $$f $(DESTDIR)$(includedir)/$$f ;; \
	  *)        $(INSTALL_DATA) $$f $(DESTDIR)$(includedir)/windows/$$f ;; \
	esac; done

# Don't just do a rm -rf on $(includedir) -- don't want to wipe out
# anything extra the user may have put there.
uninstall::
	for f in $(SRCDIR_INCLUDES) $(OBJDIR_INCLUDES); do case $$f in \
	  wine/*)   $(RM) $(DESTDIR)$(includedir)/`expr $$f : 'wine/\(.*\)'` ;; \
	  msvcrt/*) $(RM) $(DESTDIR)$(includedir)/$$f ;; \
	  *)        $(RM) $(DESTDIR)$(includedir)/windows/$$f ;; \
	esac; done
	-rmdir $(INSTALLDIRS)

### Dependencies:
activaut.h: activaut.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
activdbg.h: activdbg.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h activscp.idl
activscp.h: activscp.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
amstream.h: amstream.idl unknwn.idl wtypes.idl basetsd.h guiddef.h \
 mmstream.idl strmif.idl objidl.idl devenum.idl oaidl.idl axcore.idl \
 axextend.idl dyngraph.idl vmrender.idl
amvideo.h: amvideo.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
austream.h: austream.idl unknwn.idl wtypes.idl basetsd.h guiddef.h \
 mmstream.idl
bits.h: bits.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
bits1_5.h: bits1_5.idl bits.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
comcat.h: comcat.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
control.h: control.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
d3d10.h: d3d10.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h ocidl.idl oleidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h dxgi.idl dxgitype.idl
ddstream.h: ddstream.idl unknwn.idl wtypes.idl basetsd.h guiddef.h \
 mmstream.idl
dimm.h: dimm.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
dispex.h: dispex.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
docobj.h: docobj.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
downloadmgr.h: downloadmgr.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h ocidl.idl oleidl.idl objidl.idl oaidl.idl servprov.idl \
 urlmon.idl msxml.idl msxmldid.h
dxgi.h: dxgi.idl dxgitype.idl oaidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h ocidl.idl oleidl.idl servprov.idl \
 urlmon.idl msxml.idl msxmldid.h
dxgitype.h: dxgitype.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h ocidl.idl oleidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
exdisp.h: exdisp.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h docobj.idl olectl.h ocidl.h rpc.h windef.h \
 winnt.h pshpack2.h poppack.h pshpack8.h pshpack4.h winbase.h \
 winerror.h windows.h winresrc.h dlgs.h winver.h excpt.h wingdi.h \
 winuser.h winnls.h wincon.h winreg.h reason.h winnetwk.h cderr.h \
 dde.h ddeml.h lzexpand.h mmsystem.h pshpack1.h nb30.h shellapi.h \
 winsock2.h winsock.h wincrypt.h bcrypt.h winspool.h ole2.h objbase.h \
 rpcndr.h wtypes.h unknwn.h objidl.h cguid.h urlmon.h oleidl.h \
 servprov.h msxml.h oaidl.h propidl.h oleauto.h commdlg.h prsht.h \
 winsvc.h mcx.h imm.h rpcdce.h rpcdcep.h rpcnterr.h rpcasync.h \
 exdispid.h
fusion.h: fusion.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
hlink.h: hlink.idl urlmon.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h oleidl.idl servprov.idl msxml.idl msxmldid.h \
 oaidl.idl
htiframe.h: htiframe.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl
iads.h: iads.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
icftypes.h: icftypes.idl wtypes.idl basetsd.h guiddef.h
imnact.h: imnact.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
imnxport.h: imnxport.idl imnact.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
indexsrv.h: indexsrv.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
mediaobj.h: mediaobj.idl unknwn.idl wtypes.idl basetsd.h guiddef.h \
 objidl.idl
mimeinfo.h: mimeinfo.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
mimeole.h: mimeole.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h propidl.idl
mlang.h: mlang.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
mmstream.h: mmstream.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
mscoree.h: mscoree.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
mshtmhst.h: mshtmhst.idl ocidl.idl oleidl.idl objidl.idl unknwn.idl \
 wtypes.idl basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h docobj.idl
mshtml.h: mshtml.idl mshtmdid.h mshtmcid.h olectl.h ocidl.h rpc.h \
 windef.h winnt.h basetsd.h guiddef.h pshpack2.h poppack.h pshpack8.h \
 pshpack4.h winbase.h winerror.h windows.h winresrc.h dlgs.h winver.h \
 excpt.h wingdi.h winuser.h winnls.h wincon.h winreg.h reason.h \
 winnetwk.h cderr.h dde.h ddeml.h lzexpand.h mmsystem.h pshpack1.h \
 nb30.h shellapi.h winsock2.h winsock.h wincrypt.h bcrypt.h winspool.h \
 ole2.h objbase.h rpcndr.h wtypes.h unknwn.h objidl.h cguid.h urlmon.h \
 oleidl.h servprov.h msxml.h oaidl.h propidl.h oleauto.h commdlg.h \
 prsht.h winsvc.h mcx.h imm.h rpcdce.h rpcdcep.h rpcnterr.h rpcasync.h \
 ocidl.idl oleidl.idl objidl.idl unknwn.idl wtypes.idl oaidl.idl \
 servprov.idl urlmon.idl msxml.idl msxmldid.h dimm.idl shtypes.idl
msinkaut.h: msinkaut.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h ocidl.idl oleidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h
mstask.h: mstask.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h oleidl.idl
msxml.h: msxml.idl msxmldid.h unknwn.idl wtypes.idl basetsd.h \
 guiddef.h objidl.idl oaidl.idl
msxml2.h: msxml2.idl msxml2did.h olectl.h ocidl.h rpc.h windef.h \
 winnt.h basetsd.h guiddef.h pshpack2.h poppack.h pshpack8.h \
 pshpack4.h winbase.h winerror.h windows.h winresrc.h dlgs.h winver.h \
 excpt.h wingdi.h winuser.h winnls.h wincon.h winreg.h reason.h \
 winnetwk.h cderr.h dde.h ddeml.h lzexpand.h mmsystem.h pshpack1.h \
 nb30.h shellapi.h winsock2.h winsock.h wincrypt.h bcrypt.h winspool.h \
 ole2.h objbase.h rpcndr.h wtypes.h unknwn.h objidl.h cguid.h urlmon.h \
 oleidl.h servprov.h msxml.h oaidl.h propidl.h oleauto.h commdlg.h \
 prsht.h winsvc.h mcx.h imm.h rpcdce.h rpcdcep.h rpcnterr.h rpcasync.h \
 unknwn.idl wtypes.idl objidl.idl oaidl.idl
netfw.h: netfw.idl icftypes.idl wtypes.idl basetsd.h guiddef.h \
 oaidl.idl objidl.idl unknwn.idl
oaidl.h: oaidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
objidl.h: objidl.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
objsafe.h: objsafe.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
ocidl.h: ocidl.idl oleidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h oaidl.idl servprov.idl urlmon.idl msxml.idl \
 msxmldid.h
ocmm.h: ocmm.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h ocidl.idl oleidl.idl servprov.idl urlmon.idl msxml.idl \
 msxmldid.h
oleacc.h: oleacc.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
oledb.h: oledb.idl wtypes.idl basetsd.h guiddef.h oaidl.idl objidl.idl \
 unknwn.idl ocidl.idl oleidl.idl servprov.idl urlmon.idl msxml.idl \
 msxmldid.h propidl.idl dbinit.idl dbs.idl dbprop.idl
oleidl.h: oleidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
optary.h: optary.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl
propidl.h: propidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oaidl.idl
pstore.h: pstore.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
qedit.h: qedit.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h ocidl.idl oleidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h amstream.idl mmstream.idl strmif.idl devenum.idl \
 axcore.idl axextend.idl dyngraph.idl vmrender.idl
richole.h: richole.idl oleidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
sensevts.h: sensevts.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
servprov.h: servprov.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
shldisp.h: shldisp.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl oaidl.idl shtypes.idl servprov.idl comcat.idl \
 shdispid.h
shobjidl.h: shobjidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl oaidl.idl docobj.idl ocidl.idl servprov.idl \
 urlmon.idl msxml.idl msxmldid.h shtypes.idl comcat.idl propidl.idl
shtypes.h: shtypes.idl wtypes.idl basetsd.h guiddef.h
strmif.h: strmif.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h devenum.idl oaidl.idl axcore.idl axextend.idl dyngraph.idl \
 vmrender.idl
tom.h: tom.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h
unknwn.h: unknwn.idl wtypes.idl basetsd.h guiddef.h
urlhist.h: urlhist.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl oaidl.idl docobj.idl ocidl.idl servprov.idl \
 urlmon.idl msxml.idl msxmldid.h
urlmon.h: urlmon.idl objidl.idl unknwn.idl wtypes.idl basetsd.h \
 guiddef.h oleidl.idl servprov.idl msxml.idl msxmldid.h oaidl.idl
vmr9.h: vmr9.idl unknwn.idl wtypes.idl basetsd.h guiddef.h
wine/itss.h: wine/itss.idl oaidl.idl objidl.idl unknwn.idl wtypes.idl \
 basetsd.h guiddef.h
wine/svcctl.h: wine/svcctl.idl wtypes.idl basetsd.h guiddef.h
wtypes.h: wtypes.idl basetsd.h guiddef.h
xmldom.h: xmldom.idl xmldomdid.h idispids.h ocidl.idl oleidl.idl \
 objidl.idl unknwn.idl wtypes.idl basetsd.h guiddef.h oaidl.idl \
 servprov.idl urlmon.idl msxml.idl msxmldid.h
xmldso.h: xmldso.idl wtypes.idl basetsd.h guiddef.h ocidl.idl \
 oleidl.idl objidl.idl unknwn.idl oaidl.idl servprov.idl urlmon.idl \
 msxml.idl msxmldid.h idispids.h xmldsodid.h
stdole2.tlb: stdole2.idl
